<template>
  <div>
    <div class="class_mid">
      <span>首页</span>
    </div>
    <van-swipe :autoplay="3000" class="two">
      <van-swipe-item v-for="item in bannerList" :key="item.id" class="banner_swipe">
        <img :src="'http://upenglish.ayvvv.cn'+ item.image" slot="default">
      </van-swipe-item>
    </van-swipe>
    <div class="banner_text" v-for="(item, index) in banner_text" :key="index">
      <span class="texteach" v-html="item.content"></span>
    </div>
  </div>
</template>
<script>
import { banner } from '@/api/home.js'
export default {
  data () {
    return {
      bannerList: {},
      banner_text: ''
    }
  },
  components: {
  },

  created () {
    this.getBanner()
  },
  methods: {
    async getBanner () {
      this.$toast.loading({
        message: '加载中...',
        forbidClick: true,
        duration: 0
      })
      const data = await banner()
      this.bannerList = data.data.banner
      // console.log(data)
      this.banner_text = data.data.introduce
      // console.log(this.banner_text)
      this.$toast.clear()
    }
  }
}
</script>

<style scoped lang='less'>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.home_title {
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px;
}
.banner_swipe {
  width: 100%;
  height: 400px;
  img {
    max-width: 100%;
    height: auto;
  }
}
.banner_text {
  width: 100%;
  // height: 800px;
  // padding-bottom: 100px;
  background-color: #eeeeee73;
  padding-top:30px;
}
.texteach{
  display:block;
  padding-left:35px;
  padding-right:35px;
}
</style>
